<!DOCTYPE html>
<#include "/ftl/header.ftl">

<script type="text/javascript">
    $(document).ready(function () {
        var E = window.wangEditor
        var editor = new E('#editor')
        editor.customConfig.uploadImgShowBase64 =false
        editor.customConfig.onchange = function (html) {
            // 监控变化，同步更新到 textarea
            console.log(html)
            $("#content").val(html);
        }

        editor.create()

    });
    function back() {
        window.history.back(-1); //返回上一页
    }
</script>

<#include "/ftl/menu.ftl">
<body>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <ol class="breadcrumb">
                <li>内容管理</li>
            </ol>
        </div>
    </div>
    <div style="display:inline">
        <form  method="post"  enctype="multipart/form-data" id="formData">
            <div class="content controls npt text-center">

                <div class="col-md-7">
                    <div class="block">

                        <div class="content controls">

                            <div class="form-row">
                                <div class="col-md-1">名称</div>
                                <input type="hidden" name="type" value="${type!}" >
                                <input type="hidden" name="contentId" value="${content.contentId!}" >

                                <div class="col-md-9"><#if type==1> 购买页面 </#if> <#if type==2> 有问必答 </#if></div>
                            </div>
                            <div class="form-row">
                                <div class="col-md-1">内容<span style="color: red">*</span></div>
                                <div class="col-md-9" id="editor">
                                ${content.content!}
                                </div>
                                <input type="hidden"  id="content" name="content"  value='${content.content!}'>

                            </div>

                            <div class="form-row">
                                <div  class="col-md-5">
                                </div>
                                <div class="col-md-6">
                                    <input class="col-md-2  btn btn-default btn-clean"   type="submit" value="添加">
                                    <button class="btn btn-default btn-clean"   onclick="back()" type="button">返回</button>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div style="margin-left:20px;margin-top:20px;">
        右键图片复制链接插入文本中
    </div>
    <div  style="height:400px;width:300px;overflow:auto" >

        <#if imageList??>
        <#list imageList as image>
        <div >
            <image style="margin-left:20px;margin-top:20px;width:200px;height:200px;" src="${image.imageUrl!}"></image>
        </div>
    </#list>
</#if>
</div>


</body>
</html>